/**
 * Sample React Native App
 * https://github.com/facebook/react-native
 *
 * Generated with the TypeScript template
 * https://github.com/react-native-community/react-native-template-typescript
 *
 * @format
 */

import React from 'react';
import {StatusBar, useColorScheme} from 'react-native';

import {Provider} from 'react-redux';
import {PersistGate} from 'redux-persist/integration/react';

import {ReduxStore, persistor} from 'reduxState/store';
import {RootSiblingParent} from 'react-native-root-siblings';
import RootScreen from './RootScreen';

const App = () => {
  const isDarkMode = useColorScheme() === 'dark';

  return (
    <Provider store={ReduxStore}>
      <StatusBar barStyle={isDarkMode ? 'light-content' : 'dark-content'} />
      {/* 数据持久化 */}
      <PersistGate loading={null} persistor={persistor}>
        {/* 全局模态窗 */}
        <RootSiblingParent>
          <RootScreen />
        </RootSiblingParent>
      </PersistGate>
    </Provider>
  );
};

export default App;
